import pymysql

jwdb = pymysql.connect(host='127.0.0.1',port=3306,user='root',password='123456',db='school_db',charset='utf8')
jwcursor = jwdb.cursor(pymysql.cursors.DictCursor) # 默认元组，pymysql.cursors.DictCursor改为字典

sql = 'SELECT * FROM students'
jwcursor.execute(sql)

print(jwcursor.fetchone())
print(jwcursor.fetchone())
# 从id=3开始，游标不能往复
print(jwcursor.fetchall())
jwcursor.close()
jwdb.close()